package com.boot2551.service;

import com.boot2551.bean.Dept;
import com.boot2551.bean.Dept2;
import com.boot2551.mapper.DeptMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * id名为类名的首字母小写
 */
@Service
public class DeptS implements DeptMapper {
    //默认按类型装配
    @Autowired
//    @Qualifier
    public DeptMapper dm;

    /**
     *     @Transactional事务处理，方法有事务的功能
     * @param d
     * @return
     */
    @Override
    @Transactional
    public int insert(Dept d) {
        return dm.insert(d);
    }

    @Override
    public List<Dept> all() {
        return dm.all();
    }

    @Override
    public List<Dept2> all2() {
        return dm.all2();
    }

    @Override
    public int delete(int id) {
        return dm.delete(id);
    }

    @Override
    public Dept one(int id) {
        return dm.one(id);
    }

    @Override
    public int update(Dept d) {
        return dm.update(d);
    }

    @Override
    public List<Dept> page(int begin, int len) {
        return dm.page(begin,len);
    }

    @Override
    public List<Dept> find(Map<String, Object> data) {
        return dm.find(data);
    }

    @Override
    public int insertSelective(Dept d) {
        return dm.insertSelective(d);
    }

    @Override
    public int updateSelective(Dept d) {
        return dm.updateSelective(d);
    }

    @Override
    public int insertBatch(List<Dept> data) {
        return dm.insertBatch(data);
    }

    @Override
    public int insertBatch2(Map<String, Object> data) {
        return dm.insertBatch2(data);
    }
}
